package com.spa.application.service.admin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spa.application.command.admin.UserInfoLogOffCommand;
import com.spa.application.dto.PageResult;
import com.spa.application.dto.admin.UserInfoDto;
import com.spa.application.query.admin.UserInfoQuery;
import com.spa.domain.entity.UserInfo;
import com.spa.domain.service.UserInfoService;
import com.spa.infrastructure.mapper.UserInfoMapperStruct;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserInfoApplicationService {

    @Resource
    private UserInfoService userInfoService;

    /**
     * 用户列表分页方法
     * @param userInfoQuery
     * @return
     */
    public PageResult<UserInfoDto> pageUserInfo(UserInfoQuery userInfoQuery){
        Page<UserInfo> userInfoPage = userInfoService.userInfoPage(userInfoQuery);
        return UserInfoMapperStruct.INSTANCE.entity2UserInfoDto4Page(userInfoPage);
    }

    /**
     * 重置新用户
     * @param userInfoLogOffCommand
     * @return
     */
    public Boolean logOffUser(UserInfoLogOffCommand userInfoLogOffCommand) {
        return userInfoService.logOffUser(userInfoLogOffCommand);
    }
}
